package com.example.myapp;

import android.content.Intent;

import java.util.HashMap;

public class MapData {
    public static final int MAX_LEVEL = 5;
    // 1 代表墙壁 2代表箱子 3代表需要推到的位置 4是人  0是空地
    private static int[][] map1 = {
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 0, 0, 0, 0, 0, 1, 0, 0, 1},
            {1, 0, 2, 0, 0, 0, 1, 0, 0, 1},
            {1, 0, 0, 0, 0, 0, 1, 0, 0, 1},
            {1, 0, 0, 0, 0, 0, 0, 1, 0, 1},
            {1, 0, 0, 0, 0, 0, 0, 1, 0, 1},
            {1, 0, 0, 1, 0, 0, 0, 0, 0, 1},
            {1, 1, 1, 1, 0, 0, 0, 0, 0, 1},
            {1, 0, 0, 0, 4, 0, 0, 0, 3, 1},
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
    };
    private static int[][] map2 = {
            {1, 1, 1, 1, 1, 1, 1, 1, 1,0 ,1},
            {1, 1, 0, 0, 0, 0, 1, 0, 0,0 ,1},
            {1, 0, 2, 0, 0, 0, 1, 0, 0,0 ,1},
            {1, 0, 0, 1, 0, 0, 1, 0, 0,0 ,1},
            {1, 0, 0, 0, 0, 0, 0, 1, 0,0 ,1},
            {1, 0, 0, 0, 0, 0, 0, 1, 0,0 ,1},
            {1, 0, 0, 1, 0, 0, 0, 0, 0,0 ,1},
            {1, 1, 1, 1, 1, 1, 0, 0, 0,0 ,1},
            {1, 0, 0, 0, 4, 0, 0, 0, 3,0 ,1},
            {1, 1, 1, 1, 1, 1, 1, 1, 1,0 ,1},
    };


    private static int[][] map3 = {
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 0, 0, 0, 0, 0, 1, 0, 0, 1},
            {1, 0, 2, 0, 0, 0, 1, 0, 0, 1},
            {1, 0, 0, 0, 0, 0, 1, 0, 0, 1},
            {1, 0, 0, 0, 0, 0, 0, 1, 0, 1},
            {1, 0, 0, 0, 0, 0, 0, 1, 0, 1},
            {1, 0, 0, 1, 0, 0, 0, 0, 0, 1},
            {1, 1, 1, 1, 0, 0, 0, 0, 0, 1},
            {1, 0, 0, 0, 4, 0, 0, 0, 3, 1},
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
    };
    private static int[][] map4 = {
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 0, 0, 0, 0, 0, 1, 0, 0, 1},
            {1, 0, 2, 0, 0, 0, 1, 0, 0, 1},
            {1, 0, 0, 0, 0, 0, 1, 0, 0, 1},
            {1, 0, 0, 0, 0, 0, 0, 1, 0, 1},
            {1, 0, 0, 0, 0, 0, 0, 1, 0, 1},
            {1, 0, 0, 1, 0, 0, 0, 0, 0, 1},
            {1, 1, 1, 1, 0, 0, 0, 0, 0, 1},
            {1, 0, 0, 0, 4, 0, 0, 0, 3, 1},
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
    };
    private static  int [][] map5={
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1, 0, 0, 0, 0, 0, 0, 1, 0, 1},
            {1, 0, 0, 0, 0, 0, 0, 2, 0, 1},
            {1, 0, 0, 1, 1, 1, 1, 0, 0, 1},
            {1, 1, 0, 0, 0, 3, 1, 1, 0, 1},
            {1, 0, 0, 0, 0, 1, 1, 1, 0, 1},
            {1, 0, 0, 0, 0, 0, 0, 1, 0, 1},
            {1, 0, 0, 1, 1, 1, 1, 1, 0, 1},
            {1, 0, 0, 0, 4, 0, 0, 0, 0, 1},
            {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
    };

    public static int[][] getMap(int level) {
        int[][] map;
        switch (level) {
            case 1:
                 map = new int[map1.length][map1[1].length];
                for(int i = 0;i < map1.length;i++){
                    for(int j = 0;j<map1[i].length;j++){
                        map[i][j] = map1[i][j];
                    }
                }break;
            case 2:
                map = new int[map2.length][map2[1].length];
                for(int i = 0;i < map2.length;i++){
                    for(int j = 0;j<map2[i].length;j++){
                        map[i][j] = map2[i][j];
                    }
                }break;
            case 3:
                map = new int[map3.length][map3[1].length];
                for(int i = 0;i < map3.length;i++){
                    for(int j = 0;j<map3[i].length;j++){
                        map[i][j] = map3[i][j];
                    }
                }break;
            case 4:
                map = new int[map4.length][map4[1].length];
                for(int i = 0;i < map4.length;i++){
                    for(int j = 0;j<map4[i].length;j++){
                        map[i][j] = map4[i][j];
                    }
                }break;
            case 5:
                map = new int[map5.length][map5[1].length];
                for(int i = 0;i < map5.length;i++){
                    for(int j = 0;j<map5[i].length;j++){
                        map[i][j] = map5[i][j];
                    }
                }break;
            default:
                map = new int[map1.length][map1[1].length];
                for(int i = 0;i < map1.length;i++){
                    for(int j = 0;j<map1[i].length;j++){
                        map[i][j] = map1[i][j];
                    }
                }break;
        }
        return  map;
    }
}
